#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int a[200001];
int main()
{
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	int n,k;
	int b=1;
	cin>>n;
	for(int i=1;i<n;i++)
	cin>>a[i];
	cout<<"1"<<" ";k=a[1];a[1]=3;
	while(b!=0){
		
		for(int i=2;i<=n;i++){
		if(k!=a[i]&&a[i]!=3) {
			cout<<i<<" ";k=a[i];a[i]=3;
		}
		else
		if(a[i]!=3)
		k=a[i];	}cout<<endl;
		for(int i=1;i<=n;i++)
		{
			if(a[i]!=3) break;
			if(i==n) b=0;
		}
k=5;
	}
	
	fclose(stdin);
	fclose(stdout);
	return 0;
}

